package com.hs.li.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hs.li.pojo.CarDriver;
import com.hs.li.mapper.CarDriverMapper;
import com.hs.li.service.ICarDriverService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 司机管理 服务实现类
 * </p>
 *
 * @author lhj
 * @since 2022-06-13
 */
@Service
public class CarDriverServiceImpl extends ServiceImpl<CarDriverMapper, CarDriver> implements ICarDriverService {

    @Autowired
    private CarDriverMapper carDriverMapper;


    /**
     * 根据传入carNumber 查询对应的司机数据
     * @param carNumber
     * @return
     */
    @Override
    public List<CarDriver> searchDriverByCarNumber(Integer carNumber) {

        //根据传入的 车辆编号 查询对应 司机信息
        LambdaQueryWrapper<CarDriver> carDriverLambdaQueryWrapper = new LambdaQueryWrapper<>();
        carDriverLambdaQueryWrapper.eq(CarDriver::getCarNumber,carNumber);

        List<CarDriver> carDrivers = carDriverMapper.selectList(carDriverLambdaQueryWrapper);

        return carDrivers;
    }
}
